home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / dlibs12 / getcwd.c < prev    next >
C/C++ Source or Header  |  1990-11-23  |  334b  |  19 lines

  1. #include <stdio.h>
  2. #include <limits.h>
  3. #include <malloc.h>
  4.  
  5. char *getcwd(buf, limit)
  6.     char *buf;
  7.     register int limit;
  8.     {
  9.     char cwd[PATHSIZE], *strcpy();
  10.  
  11.     if((buf == NULL)
  12.     && ((buf = malloc(limit)) == NULL))
  13.         return(NULL);
  14.     fullpath(cwd, "");
  15.     if(strlen(cwd) < limit)
  16.         return(strcpy(buf, cwd));
  17.     return(NULL);
  18.     }
  19.